package sjms.construction.composite.e1;

/**
 * @ClassName:
 * @Description:
 * @Author fcb
 * @Date 2020/6/1 14:40
 */
public class Test {

    public static void main(String[] args) {
        // 来一个根节点
        Component root = new Composite("root");
        // 来一个树枝节点
        Component branchA = new Composite("---branchA");
        Component branchB = new Composite("------branchB");
        // 来一个叶子节点
        Component leafA = new Leaf("------leafA");
        Component leafB = new Leaf("---------leafB");
        Component leafC = new Leaf("---leafC");

        root.addChil(branchA);
        root.addChil(leafC);
        branchA.addChil(leafA);
        branchA.addChil(branchB);
        branchB.addChil(leafB);

        root.operation();
    }
}
